﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ScrumFactory.Services.Logic.Helper {

    public class Log {

        public static void LogError(Exception ex) {

            try {
                string logPath = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/log.txt");

                System.IO.FileStream fstream = new FileStream(logPath, FileMode.Append);

                StreamWriter writer = new StreamWriter(fstream);
                writer.WriteLine(DateTime.Now);
                writer.WriteLine(ex.Message);
                writer.WriteLine(ex.StackTrace.ToString());
                writer.WriteLine("------------------------------------------------------------------------------");
                writer.Close();
            }
            catch (Exception) { }

        }

    }
}
